//
//  FYHomeViewController.swift
//  douyuzhibo
//
//  Created by 杜方宜 on 2017/7/13.
//  Copyright © 2017年 pelesys-luoyang. All rights reserved.
//

import UIKit

private let kTitleViewH : CGFloat = 40

class FYHomeViewController: UIViewController {
//MARK:-懒加载属性
    fileprivate lazy var pageTitleView: FYPageTitleView = {
        let titleFrame = CGRect(x: 0, y: kStatusBarH + kNavigationBarH, width: kScreenW, height: kTitleViewH)
        let titles = ["推荐", "游戏", "娱乐", "趣玩"]
        let titleView = FYPageTitleView(frame: titleFrame, titles: titles)
//        titleView.backgroundColor = UIColor.purple
        return titleView
    }()
// MARK:-系统回调函数
    override func viewDidLoad() {
        super.viewDidLoad()
      setupUI()
    }

}
// MARK:-设置UI界面
extension FYHomeViewController{
    fileprivate func setupUI(){
        // 0.不需要调整UIScrollView的内边距
        automaticallyAdjustsScrollViewInsets = false
        //1 设置导航栏
        setupNavigationBar()
        // 2.添加TitleView
        view.addSubview(pageTitleView)
    }
    fileprivate func setupNavigationBar(){
        // 1.设置左侧的Item
      navigationItem.leftBarButtonItem  = UIBarButtonItem(imageName: "logo")
        // 2.设置右侧的Item
        let size = CGSize(width: 40, height: 40)
        let historyItem = UIBarButtonItem(imageName: "image_my_history", highImageName: "Image_my_history_click", size: size)
        let searchItem = UIBarButtonItem(imageName: "btn_search", highImageName: "btn_search_clicked", size: size)
        let qrcodeItem = UIBarButtonItem(imageName: "Image_scan", highImageName: "Image_scan_click", size: size)
        navigationItem.rightBarButtonItems = [historyItem, searchItem, qrcodeItem]
        
    }
}
